<template>
  <div>
<van-address-edit
  :area-list="areaList"
  show-search-result
  :search-result="searchResult"
  :area-columns-placeholder="['请选择', '请选择', '请选择']"
  @save="onSave"
  @change-detail="onChangeDetail"
/>
  </div>
</template>

<script>
import Vue from 'vue';
import { AddressEdit,Toast,AddressList } from 'vant'
import area from '../utils/cityjson.js'
Vue.use(AddressEdit).use(Toast)
export default {
data () {
    return {
        areaList:{},
      searchResult: []
    }
},
methods: {
     onSave(content) {
      Toast('保存成功')
      let obj={
          name:content.name,
          tel:content.tel,
          address:content.addressDetail
      }     
     this.$router.push({
          path:'/adress',
          query:{
              data:obj
          }
      })    
    },
  
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [{
          name: '北科千峰',
          address: '北京市昌平区'
        }];
      } else {
        this.searchResult = [];
      }
    }
},
mounted () {
   this.areaList=area
    
}

}
</script>

<style>

</style>